/********************************************************************************
 * Copyright(c) 2020-2025 BST All rights reserved.
 * - Filename
 * - Author
 * - Version V1.0.0
 * - Date    2024/08/28
 * - Brief
 * - FunctionList:
 ******************************************************************************
 * History:
 *
 *
 *
 ******************************************************************************
 */
#pragma once
#include "Lidar.hpp"
#include <condition_variable>
#include <deque>
#include <memory>
#include <mutex>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
#include <thread>
#include <vector>
namespace lidar
{
  class LidarRecoder
  {
  public:
    LidarRecoder(std::vector<std::unique_ptr<Lidar>> &&lidars,
                 const std::string &path);
    ~LidarRecoder();
    void start();
    void stop();
    void setDbFile(const bool &v);
    void control(const std::string &cmd);

  private:
    bool _isDbfile{false};
    std::string _savedPath{};
    std::string _controlCmd{""};
    std::vector<std::unique_ptr<Lidar>> _lidars;
    std::string getDirectory(const tm &ts, uint32_t id);
    std::string getFilePath(uint64_t us, const std::string &dir,
                            const std::string &file);
  };

} // namespace lidar
